﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EuphoricNation.Rewrite
{
    /// <summary>
    /// A redirect
    /// </summary>
    public class Redirect
    {
        /// <summary>
        /// Is this a permanent redirect?
        /// </summary>
        public bool Permanent { get; set; }

        /// <summary>
        /// Is the From URL encoded?
        /// </summary>
        public bool FromUrlEncoded { get; set; }

        /// <summary>
        /// Is the To URL encoded?
        /// </summary>
        public bool ToUrlEncoded { get; set; }

        /// <summary>
        /// The URL to match for redirecting
        /// </summary>
        public string FromURL { get; set; }

        /// <summary>
        /// The URL to redirect to
        /// </summary>
        public string ToURL { get; set; }

        /// <summary>
        /// Redirect
        /// </summary>
        public Redirect()
        {
            FromUrlEncoded = false;
            ToUrlEncoded = true;
        }

        /// <summary>
        /// Redirect
        /// </summary>
        /// <param name="from">From URL</param>
        /// <param name="to">To URL</param>
        /// <param name="permanent">Permanent redirect</param>
        public Redirect(string from, string to, bool permanent)
        {
            FromUrlEncoded = false;
            ToUrlEncoded = true;

            FromURL = from;
            ToURL = to;
            Permanent = permanent;
        }

        /// <summary>
        /// Redirect
        /// </summary>
        /// <param name="from">From URL</param>
        /// <param name="to">To URL</param>
        /// <param name="permanent">Permanent redirect</param>
        /// <param name="fromEncoded">From URL encoded</param>
        /// <param name="toEncoded">To URL encoded</param>
        public Redirect(string from, string to, bool permanent, bool fromEncoded, bool toEncoded)
        {
            FromURL = from;
            ToURL = to;
            Permanent = permanent;
            FromUrlEncoded = fromEncoded;
            ToUrlEncoded = toEncoded;
        }
    }
}
